package com.wc.alorithm_blue_bridge_history.littlewhite.Q231223.Q9992;

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * @Author congege
 * @Description https://www.lanqiao.cn/problems/9992/learning/?contest_id=154
 * @Date Created in 2023/12/23-19:02
 */
public class Main {
    static FastReader in = new FastReader();
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    static int maxN = (int) 1e4 + 10;
    static Point[] points = new Point[maxN];

    public static void main(String[] args) {
        long n = in.nextLong();
        int m = in.nextInt();
        for (int i = 1; i <= m; i++) {
            points[i] = new Point();
            points[i].x = in.nextLong();
            points[i].y = in.nextLong();
        }
        Comparator<Point> comparator = new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                if (o1.y > o2.y) {
                    return 1;
                } else {
                    return -1;
                }
            }
        };
        Arrays.sort(points, 1, m + 1);
        long m1 = Math.abs(points[1].x - points[m].x) + 1;
        Arrays.sort(points, 1, m + 1, comparator);
        long m2 = Math.abs(points[1].y - points[m].y) + 1;
        out.println(Math.max(m1,m2));
        out.flush();
    }

    static class Point implements Comparable<Point> {
        long x;
        long y;

        @Override
        public int compareTo(Point o) {
            if (this.x > o.x) {
                return 1;
            } else {
                return -1;
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    int nextInt() {
        return Integer.parseInt(next());
    }
}
